package com.zzl.finance.data.controller;

import com.zzl.apidoc.annotation.ApidocController;
import com.zzl.apidoc.annotation.ApidocOperation;
import com.zzl.apidoc.annotation.ApidocParam;
import com.zzl.finance.data.dto.VoucherEnterpriseCertificationUpdateDto;
import com.zzl.finance.data.service.EnterpriseService;
import com.zzl.general.common.apidoc.annotation.ApidocReturnR;
import com.zzl.general.common.ctrl.WebBaseCtrl;
import com.zzl.general.common.exception.SysException;
import com.zzl.general.common.utils.LogUtils;
import com.zzl.general.common.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gull
 * @date 2021-11-09 20:04:58
 */
@ApidocController("供应商注册记录")
@RestController
@SuppressWarnings("javadoc")
@RequestMapping("data/registrationRecord")
@Slf4j
public class EnterpriseRegistrationApplicationRecordController extends WebBaseCtrl {

    @Autowired
    private EnterpriseService enterpriseService;


    /**
     * 修改
     */
    @PutMapping("/update")
    @ApidocOperation(description = "企业信息修改", operationId = "4004")
    @ApidocReturnR
    public Result update(@ApidocParam(name = "修改的开立或转让签订的协议对象值", required = true) @RequestBody VoucherEnterpriseCertificationUpdateDto enterpriseUpdateDto) {
        try {
            enterpriseService.updateEnterpriseById(enterpriseUpdateDto, this.getUser());
            return Result.ok();
        } catch (SysException e) {
            LogUtils.logSysException(log, e);
            return Result.error(e.getMsg());
        }
    }
}
